package com.ts.system.service.impl;

import com.ts.animal.service.BaseStationService;
import com.ts.animal.service.WarningSetService;
import com.ts.common.service.DictService;
import com.ts.system.base.BaseInterface;
import com.ts.system.service.DeptService;
import com.ts.system.service.SystemParamsService;
import com.ts.system.service.UserService;
import com.ts.system.util.SystemUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;

@Service
public class SystemServiceImpl implements BaseInterface {

    @Autowired
    private UserService userService;
    @Autowired
    private DeptService sysDeptService;
    @Autowired
    private SystemParamsService systemParamsService;
    @Autowired
    private ThymeleafViewResolver thymeleafViewResolver;

    @Autowired
    private DictService dictService;
    @Autowired
    private WarningSetService warningSetService;
    @Autowired
    private BaseStationService baseStationService;

    @Override
    public void init() {
        SystemUtil.setViewResolver(thymeleafViewResolver);
        SystemUtil.setUsers(userService.users());
        SystemUtil.setIdDepts(sysDeptService.depts());
        SystemUtil.setSystemParams(systemParamsService.systemParams());
        SystemUtil.setDicts(dictService.dicts());
        SystemUtil.setWarningSets(warningSetService.warningSets());
        baseStationService.baseStationToCache();
    }
}
